PROJECT=rays

OPTIMIZATION=-o3 -march=native -msse -msse2 -msse3 -msse4a -m3dnow -mmmx

DIRS_INCLUDE=-Iinclude -Isrc

DIRS_LIB_STATIC=-Llib/static
DIRS_LIB_DYNAMIC=-Iinclude -Llib/dynamic

DIRS_LIB=$(DIRS_LIB_DYNAMIC) $(DIRS_LIB_STATIC)

#LIBS_BOOST=-lboost_date_time -lboost_filesystem -lboost_log  -lboost_regex -lboost_thread -lboost_system
LIBS_BOOST_STATIC=-lboost_thread
LIBS_BOOST_DYNAMIC=-lboost_thread.so
LIBS_MISC=-lpthread
MISC_OPTIONS=

WARNING_OPTIONS=-Wall

DEBUG_OPTIONS=  -g $(DIRS_INCLUDE)                  $(WARNING_OPTIONS)  $(MISC_OPTIONS)
RELEASE_OPTIONS=   $(DIRS_INCLUDE) $(OPTIMIZATION)  $(WARNING_OPTIONS)  $(MISC_OPTIONS)
############################################################################
All: Debug
############################################################################
obj/Release/config.o: src/config.cpp src/config.hpp src/definitions.hpp
	g++  -c  $(RELEASE_OPTIONS)   src/config.cpp                    -o obj/Release/config.o

obj/Release/vector.o: src/vector.cpp src/vector.hpp src/definitions.hpp
	g++  -c  $(RELEASE_OPTIONS)   src/vector.cpp                    -o obj/Release/vector.o

obj/Release/parser.o: src/parser.cpp src/parser.hpp src/definitions.hpp
	g++  -c  $(RELEASE_OPTIONS)   src/parser.cpp                    -o obj/Release/parser.o

obj/Release/scene.o: src/scene.cpp src/scene.hpp src/definitions.hpp
	g++  -c  $(RELEASE_OPTIONS)   src/scene.cpp                     -o obj/Release/scene.o

obj/Release/color.o: src/color.cpp src/color.hpp src/definitions.hpp
	g++  -c  $(RELEASE_OPTIONS)   src/color.cpp                     -o obj/Release/color.o

obj/Release/primitive.o: src/primitive.cpp src/primitive.hpp src/definitions.hpp
	g++  -c  $(RELEASE_OPTIONS)   src/primitive.cpp                 -o obj/Release/primitive.o

obj/Release/camera.o: src/Camera.cpp src/Camera.hpp src/definitions.hpp
	g++  -c  $(RELEASE_OPTIONS)   src/Camera.cpp                    -o obj/Release/camera.o

obj/Release/ThreadFuncWork.o: src/ThreadFuncWork.cpp src/ThreadFuncWork.hpp src/definitions.hpp
	g++  -c  $(RELEASE_OPTIONS)   src/ThreadFuncWork.cpp            -o obj/Release/ThreadFuncWork.o

obj/Release/main_test.o: src/main_test.cpp src/definitions.hpp
	g++  -c  $(RELEASE_OPTIONS)   src/main_test.cpp                 -o obj/Release/main_test.o


Release: obj/Release/vector.o obj/Release/camera.o obj/Release/primitive.o obj/Release/scene.o  obj/Release/main_test.o obj/Release/config.o obj/Release/parser.o obj/Release/ThreadFuncWork.o obj/Release/color.o
	g++      $(RELEASE_OPTIONS)  $(DIRS_LIB)     obj/Release/*.o                      -o  bin/Release/$(PROJECT) -lIL  $(LIBS_BOOST_STATIC)

############################################################################
obj/Debug/config.o: src/config.cpp src/config.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)   src/config.cpp                    -o obj/Debug/config.o

obj/Debug/vector.o: src/vector.cpp src/vector.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)   src/vector.cpp                    -o obj/Debug/vector.o

obj/Debug/parser.o: src/parser.cpp src/parser.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)   src/parser.cpp                    -o obj/Debug/parser.o

obj/Debug/scene.o: src/scene.cpp src/scene.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)   src/scene.cpp                     -o obj/Debug/scene.o

obj/Debug/color.o: src/color.cpp src/color.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)   src/color.cpp                     -o obj/Debug/color.o

obj/Debug/primitive.o: src/primitive.cpp src/primitive.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)   src/primitive.cpp                 -o obj/Debug/primitive.o

obj/Debug/camera.o: src/Camera.cpp src/Camera.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)   src/Camera.cpp                    -o obj/Debug/camera.o

obj/Debug/ThreadFuncWork.o: src/ThreadFuncWork.cpp src/ThreadFuncWork.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)   src/ThreadFuncWork.cpp            -o obj/Debug/ThreadFuncWork.o

obj/Debug/main_test.o: src/main_test.cpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)   src/main_test.cpp                 -o obj/Debug/main_test.o


Debug: obj/Debug/vector.o obj/Debug/camera.o obj/Debug/primitive.o obj/Debug/scene.o  obj/Debug/main_test.o obj/Debug/config.o obj/Debug/parser.o obj/Debug/ThreadFuncWork.o obj/Debug/color.o
	g++      $(DEBUG_OPTIONS)  $(DIRS_LIB)     obj/Debug/*.o                      -o  bin/Debug/$(PROJECT) -lIL  $(LIBS_BOOST_STATIC)

############################################################################	
obj/Test/config.o: src/config.cpp src/config.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)  $(DIRS_INCLUDE) src/config.cpp                    -o obj/Test/config.o

#$(OPTIMIZATION)

obj/Test/vector.o: src/vector.cpp src/vector.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)   $(DIRS_INCLUDE) src/vector.cpp    -o obj/Test/vector.o

obj/Test/scene.o: src/scene.cpp src/scene.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)  $(DIRS_INCLUDE) src/scene.cpp                     -o obj/Test/scene.o

obj/Test/color.o: src/color.cpp src/color.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)  $(DIRS_INCLUDE) src/color.cpp                     -o obj/Test/color.o


obj/Test/primitive.o: src/primitive.cpp src/primitive.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)  $(DIRS_INCLUDE) src/primitive.cpp                 -o obj/Test/primitive.o

obj/Test/camera.o: src/Camera.cpp src/Camera.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)  $(DIRS_INCLUDE) src/Camera.cpp                    -o obj/Test/camera.o

obj/Test/ThreadFuncWork.o: src/ThreadFuncWork.cpp src/ThreadFuncWork.hpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)  $(DIRS_INCLUDE) src/ThreadFuncWork.cpp            -o obj/Test/ThreadFuncWork.o

obj/Test/main_test.o: src/main_test.cpp src/definitions.hpp
	g++  -c  $(DEBUG_OPTIONS)  $(DIRS_INCLUDE) src/main_test.cpp                 -o obj/Test/main_test.o

	
Test: obj/Test/vector.o obj/Test/camera.o obj/Test/primitive.o obj/Test/scene.o  obj/Test/main_test.o obj/Test/config.o obj/Test/ThreadFuncWork.o obj/Test/color.o
	g++      $(DEBUG_OPTIONS)  $(DIRS_LIB)     obj/Test/*.o                      -o  bin/Test/$(PROJECT) -lIL  $(LIBS_BOOST_STATIC) $(LIBS_MISC)
#	rm -f bin/Test/lol
#	time bin/Test/rays>log
############################################################################
Clean:
	rm -rf bin/*
	rm -rf obj/*
############################################################################
Init:
	mkdir -p bin/Debug
	mkdir -p bin/Release
	mkdir -p obj/Debug
	mkdir -p obj/Release
	mkdir -p obj/Test
	mkdir -p bin/Test
	link config.json bin/Test/config.json
	link config.json bin/Release/config.json
	link config.json bin/Debug/config.json
############################################################################

